export interface GraphNode {
  id: string;
  label: string;
  properties: {
    datasetId: string;
    index: string;
    id: string;
    title: string;
    type: string;
    parentId?: string;
  };
  group: string;
}

export interface GraphLink {
  source: string;
  id: string;
  type: string;
  properties: Record<string, any>;
  target: string;
}

export interface GraphData {
  nodes: GraphNode[];
  links: GraphLink[];
}

// 节点详情模拟数据接口
export interface MockNodeDetail {
  labels: string[];
  properties: Record<string, any>;
}

// 创建节点详情模拟数据
export const createMockNodeDetail = (nodeId: string): MockNodeDetail => {
  const mockDetails: Record<string, MockNodeDetail> = {
    "0": {
      labels: ["Document", "Enterprise"],
      properties: {
        title: "佩小格企业信息&联系人信息.docx",
        type: "企业信息文档",
        text: "佩小格企业信息详细内容：\n\n公司名称：佩小格科技有限公司\n注册地址：北京市海淀区中关村软件园\n成立时间：2020年3月15日\n注册资本：1000万元人民币\n经营范围：软件开发、技术咨询、系统集成\n联系电话：010-12345678\n企业邮箱：contact@peixiaoge.com\n\n主要业务：\n1. 企业级软件解决方案\n2. 云计算服务\n3. 大数据分析\n4. 人工智能应用",
        createdTime: "2024-01-15 10:30:00",
        updatedTime: "2024-01-20 14:20:00",
        fileSize: "2.5MB",
        documentId: "1951941964145823745_3afa7842-6c2e-4fad-9fcf-a7e8f57bb835",
        status: "已处理"
      }
    },
    "1": {
      labels: ["Summary", "Enterprise"],
      properties: {
        title: "佩小格企业信息摘要",
        type: "摘要信息",
        text: "佩小格科技有限公司是一家专注于企业级软件解决方案的高新技术企业，成立于2020年，注册资本1000万元，主要从事软件开发、云计算服务、大数据分析和人工智能应用等业务。公司位于北京市海淀区中关村软件园，拥有完善的技术团队和丰富的项目经验。",
        summaryType: "自动生成",
        confidence: 0.95,
        keywords: ["企业信息", "软件开发", "云计算", "大数据", "人工智能"],
        wordCount: 156
      }
    },
    "13": {
      labels: ["Document", "Technical"],
      properties: {
        title: "ISV应用适配测试报告",
        type: "技术文档",
        text: "DM8-CFP微服务开发平台适配测试报告\n\n测试概述：\n本报告详细记录了CFP微服务开发平台与达梦数据库(DM8)的适配测试过程和结果。\n\n测试环境：\n- 操作系统：CentOS 7.9\n- 数据库：达梦数据库 DM8 V8.1.2.128\n- 应用平台：CFP微服务开发平台 v3.6.0\n- JDK版本：OpenJDK 1.8.0_292\n\n测试项目：\n1. 数据库连接测试\n2. CRUD操作测试\n3. 事务处理测试\n4. 性能测试\n5. 稳定性测试\n\n测试结果：\n所有测试项目均通过，平台与DM8数据库适配良好，功能完整，性能稳定。",
        testDate: "2024-01-10",
        testResult: "通过",
        tester: "技术团队",
        version: "v1.2",
        pageCount: 25
      }
    }
  };

  // 如果有对应的模拟数据，返回；否则返回默认模拟数据
  return mockDetails[nodeId] || {
    labels: ["Document", "Unknown"],
    properties: {
      title: `节点 ${nodeId} 详情`,
      type: "文档",
      text: `这是节点 ${nodeId} 的详细信息。包含了该节点的基本属性、内容摘要以及相关的元数据信息。此节点可能包含重要的业务数据或文档内容，需要进一步分析和处理。\n\n节点ID: ${nodeId}\n创建时间: ${new Date().toLocaleString()}\n状态: 活跃\n\n详细内容将在实际系统中从数据库或其他数据源获取。`,
      nodeId: nodeId,
      createdTime: new Date().toLocaleString(),
      status: "模拟数据",
      dataSource: "Mock"
    }
  };
};

export const createSampleData = (): GraphData => {
  return {
    "nodes": [
      {
        "id": "0",
        "label": "佩小格企业信息&联系人信息.docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "0",
          "id": "1951941964145823745_3afa7842-6c2e-4fad-9fcf-a7e8f57bb835",
          "title": "佩小格企业信息&联系人信息.docx",
          "type": "0",
          "parentId": "parent_5e30833e-e6bd-4dd9-bd28-15ea81f2cb0b"
        },
        "group": "SummaryChunk"
      },
      {
        "id": "1",
        "label": "佩小格企业信息&联系人信息.docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "0",
          "id": "1951941964145823745_3afa7842-6c2e-4fad-9fcf-a7e8f57bb835",
          "title": "佩小格企业信息&联系人信息.docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "13",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "11",
          "id": "1952021668433481730_22a6bb47-feaf-4894-8569-0337bee9fe1f",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0",
          "parentId": "parent_2670167a-1dc2-445a-9798-37f0d3cada78"
        },
        "group": "SummaryChunk"
      },
      {
        "id": "14",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "0",
          "id": "1952021668433481730_60a4fc13-b48f-4a41-ad7b-51d346e020f8",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "15",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "1",
          "id": "1952021668433481730_a66331f8-45c9-4e58-b2b5-4583057da346",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "16",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "2",
          "id": "1952021668433481730_cb37bdb3-a654-4768-905d-dfefab86909a",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "17",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "3",
          "id": "1952021668433481730_20d02eb9-ecd4-47fb-9eb4-5932d69f486d",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "18",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "4",
          "id": "1952021668433481730_8fd2c2b9-e962-40fc-a235-ab754c6223d7",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "19",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "5",
          "id": "1952021668433481730_3e9883a6-d431-4148-9e7e-8919bd244bef",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "20",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "6",
          "id": "1952021668433481730_aa3665a0-114f-4fb1-afa9-f80598a393fa",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "21",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "7",
          "id": "1952021668433481730_65a626c3-1372-456d-8a75-2705473a5bd2",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "22",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "8",
          "id": "1952021668433481730_f93f4a15-0b93-4547-adb9-6285f4eef2f4",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "23",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "9",
          "id": "1952021668433481730_291ff667-e43b-4d4c-8d6d-aaded371973d",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "24",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "10",
          "id": "1952021668433481730_397a1a70-5fea-4753-9546-dac40748e4c9",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      },
      {
        "id": "25",
        "label": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
        "properties": {
          "datasetId": "1951941936505360386",
          "index": "11",
          "id": "1952021668433481730_22a6bb47-feaf-4894-8569-0337bee9fe1f",
          "title": "附件4：ISV应用适配测试报告(DM8-CFP微服务开发平台).docx",
          "type": "0"
        },
        "group": "Summary"
      }
    ],
    "links": [
      {
        "source": "0",
        "id": "0",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "1"
      },
      {
        "source": "13",
        "id": "1",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "14"
      },
      {
        "source": "13",
        "id": "2",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "15"
      },
      {
        "source": "13",
        "id": "3",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "16"
      },
      {
        "source": "13",
        "id": "4",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "17"
      },
      {
        "source": "13",
        "id": "5",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "18"
      },
      {
        "source": "13",
        "id": "6",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "19"
      },
      {
        "source": "13",
        "id": "7",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "20"
      },
      {
        "source": "13",
        "id": "8",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "21"
      },
      {
        "source": "13",
        "id": "9",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "22"
      },
      {
        "source": "13",
        "id": "10",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "23"
      },
      {
        "source": "13",
        "id": "11",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "24"
      },
      {
        "source": "13",
        "id": "12",
        "type": "HAS_SUMMARY",
        "properties": {},
        "target": "25"
      }
    ]
  };
};
